<!DOCTYPE html>
<html class="x-admin-sm">
 {include file="public/head"}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form"  action="{:url('Admin/shucaieditsave')}"  method="post">
                   <div class="layui-form-item">
                      <label for="url" class="layui-form-label">
                          <span class="x-red">*</span>图片
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="url" name="url" required=""  lay-verify="required" value="{$vegetable->url}" 
                          autocomplete="off" class="layui-input">
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                   </div>
                 <div class="layui-form-item">
                      <label for="vname" class="layui-form-label">
                          <span class="x-red">*</span>蔬菜名
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="vname" name="vname" required="" lay-verify="required"  value="{$vegetable->vname}" 
                          autocomplete="off" class="layui-input">
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="paixu" class="layui-form-label">
                          <span class="x-red">*</span>排序
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="paixu" name="paixu" required="" lay-verify="required"  value="{$vegetable->paixu}"
                          autocomplete="off" class="layui-input">
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="kucun" class="layui-form-label">
                          <span class="x-red">*</span>库存
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="kucun" name="kucun" required="" lay-verify="required"   value="{$vegetable->kucun}"
                          autocomplete="off" class="layui-input">
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="price" class="layui-form-label">
                          <span class="x-red">*</span>单价
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="L_email" name="price" required="" lay-verify="required"   value="{$vegetable->price}"
                          autocomplete="off" class="layui-input">
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                  </div>
<!--                  <div class="layui-form-item">
                      <label for="leixing" class="layui-form-label">
                          <span class="x-red">*</span>蔬菜类型
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="leixing" name="leixing" required="" lay-verify="required"  value="{$vegetable->leixing}"
                          autocomplete="off" class="layui-input">
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                  </div> -->
                 <div class="layui-form-item">
                      <label for="gongyingshang" class="layui-form-label">
                          <span class="x-red">*</span>供应商
                      </label>
                      <div class="layui-input-inline">
<!--                           <input type="text" id="gid" name="gid" required="" lay-verify="required"  value="{$vegetable->gname}"
                          autocomplete="off" class="layui-input"> -->
                          <select name="gid" lay-verify="">
                            <option value="">请选择供应商</option>
                            <option value="1">南阳供应商</option>
                            <option value="2">谷饶供应商</option>
                            <option value="3">贵屿供应商</option>
                            <option value="4">茂广供应商</option>
                            <option value="5">上堡供应商</option>
                            <option value="6">恒山供应商</option>
                            <option value="7">沟南供应商</option>
                          </select> 
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                  </div>
                  <div class="layui-form-item">
                       {if condition="$vegetable.leixing eq 1"}
                         <div class="layui-form-item">
                            <label class="layui-form-label">蔬菜类型</label>
                            <div class="layui-input-block">
                              <input type="radio" name="leixing" value="一般" title="一般">
                              <input type="radio" name="leixing" value="鲜活" title="鲜活" checked>
                            </div>
                          </div>
                        {/if}
                       {if condition="$vegetable.leixing eq 0"}
                         <div class="layui-form-item">
                            <label class="layui-form-label">蔬菜类型</label>
                            <div class="layui-input-block">
                              <input type="radio" name="leixing" value="一般" title="一般" checked>
                              <input type="radio" name="leixing" value="鲜活" title="鲜活">
                            </div>
                          </div>
                        {/if}
                  </div>
                   <input name="vid" type="hidden" value="{$vegetable->vid}"/>
                   <input name="status" type="hidden" value="1"/>
                    <input name="zhuangtai" type="hidden" value="1"/>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  type="submit" class="layui-btn"  lay-submit="" onclick="alert("0");">
                          保存
                      </button>
                  </div>
              </form>
            </div>
        </div>
        <script>
         layui.use(['form', 'layer'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;

                //自定义验证规则
                form.verify({
                    nikename: function(value) {
                        if (value.length < 5) {
                            return '昵称至少得5个字符啊';
                        }
                    },
                    pass: [/(.+){6,12}$/, '密码必须6到12位'],
                    repass: function(value) {
                        if ($('#L_pass').val() != $('#L_repass').val()) {
                            return '两次密码不一致';
                        }
                    }
                });

                //监听提交
                form.on('submit(add)',
                function(data) {
                    console.log(data);
                    //发异步，把数据提交给php
                    layer.alert("增加成功", {
                        icon: 6
                    },
                    function() {
                        //关闭当前frame
                        xadmin.close();

                        // 可以对父窗口进行刷新 
                        xadmin.father_reload();
                    });
                    return false;
                });

            });</script>
        <script>var _hmt = _hmt || []; (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();</script>
    </body>

</html>
